package com.bw.controller;


import com.bw.entity.TbUserTem;
import com.bw.service.UserTemService;
import com.bw.entity.vo.UserTemVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
public class UserTenController {
    @Autowired
    private UserTemService userTemService;
    //用户组列表
    @RequestMapping("usertemlist")
    public List<UserTemVo> usertemlist(@RequestParam("mohu")String mohu){
        return userTemService.usertemlist(mohu);
    }
    //批量删除
    @RequestMapping("temdel")
    public String  temdel(@RequestParam("id") String id){
        String[] ids=id.split(",");
        for (String a:ids){
            userTemService.temdel(a);
        }
        return "删除成功";
    }

    //添加
    @RequestMapping("temadd")
    public TbUserTem temadd(@RequestBody TbUserTem userTem){
        return userTemService.temadd(userTem);
    }
    //修改
    @RequestMapping("updUserList")
    public TbUserTem updUserList(@RequestBody TbUserTem userTem){
        return userTemService.updUserList(userTem);
    }
    //回显
    @RequestMapping("findByUserId")
    public TbUserTem findByUserId(@RequestParam("id")int id){
        return userTemService.findByUserId(id);
    }

}
